/* Exception */
object test2 {
	def main():Unit = { 
	    try {
	      println((new ExceptionTest()).initMyVar(0));
	    } catch (e : ToolException) {
	      println(e.getMessage() + " from main");
	    }	
	}
}

class ExceptionTest {
	var myVar:Int;
	var myTab:Int[];
	var myException: MyException;
    var myException2: MyException;
    
	def initMyVar(myVar2:Int):Int throws ToolException = {
	    myException = new MyException().setMsg("Hahahaha an exception");

		try {
		  throw myException;
		} catch(e: ToolException){
		  println(e.getMessage());
		  
		  myException2 = myException;
		  throw myException2;
		}

		return 1;
	}
}

class MyException extends ToolException {
	def setMsg(s: String): MyException = {
		var t: ToolException;
		t = this.setMessage(s);
		return this;
	}
}
